package com.summer.user.controller;

import java.util.Arrays;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.summer.core.annotations.ScopeType;
import com.summer.core.controller.EntityQuery;
import com.summer.user.model.Official;

@Component
@Scope(ScopeType.VIEW)
public class OfficialList extends EntityQuery<Official> {

	private final String HQL = "select official from Official official";
	private final String COUNT_HQL = "select count(official) from Official official ";

	public OfficialList() {

		setHql(HQL);
		setCountHql(COUNT_HQL);
		final String[] RESTRICTIONS = { "official.department_name like #{officialList.example.department_name}",
				"official.position_name like #{officialList.example.position_name}",
				"official.education like #{officialList.example.education}",
				"official.degree like #{officialList.example.degree}",
				"official.major like #{officialList.example.major}", 
				"official.sex like #{officialList.example.sex}",
				"official.political_face like #{officialList.example.political_face}",
				"official.work_experience like #{officialList.example.work_experience}",
				"official.department_level like #{officialList.example.department_level}",
				"official.department_nature like #{officialList.example.department_nature}" };
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
	}
}
